package com.hkbigdata.flink.utils;

/**
 * @Author: JinChen Zhu
 * @CreateTime: 2024-06-27  20:51
 */
public class Constants {
    public static String MYSQL_HOST_NAME;
    public static int MYSQL_PORT;
    public static String MYSQL_USERNAME;
    public static String MYSQL_PASSWORD;
    public static String MYSQL_DATABASE;
    public static String MYSQL_TABLE_ORDER;
    public static String MYSQL_TABLE_PRODUCT;
    public static String MYSQL_DRIVER;
    public static String MYSQL_URL;
    public static String KAFKA_HOST;
    public static String KAFKA_PORT;
    public static String KAFKA_BOOSTRAP_SERVERS;
    public static String KAFKA_TOPIC_CDC;
    public static String KAFKA_TOPIC_ORDER_WINDOW;
    public static String KAFKA_GROUP;
    public static String REDIS_HOST;
    public static int REDIS_PORT;
    public static String REDIS_PASSWORD;
    public static String REDIS_DATABASE;
    public static String REDIS_KEY;

    public static int FLINK_WINDOWS;
    public static int FLINK_WINDOWS_DELAY_TIME;

    static {
        MYSQL_HOST_NAME = PropertiesUtils.getProperty("mysql.host");
        MYSQL_PORT = Integer.parseInt(PropertiesUtils.getProperty("mysql.port"));
        MYSQL_USERNAME = PropertiesUtils.getProperty("mysql.username");
        MYSQL_PASSWORD = PropertiesUtils.getProperty("mysql.password");
        MYSQL_DATABASE = PropertiesUtils.getProperty("mysql.database");
        MYSQL_TABLE_ORDER = PropertiesUtils.getProperty("mysql.table.order");
        MYSQL_TABLE_PRODUCT = PropertiesUtils.getProperty("mysql.table.product");
        MYSQL_DRIVER = PropertiesUtils.getProperty("mysql.driver");
        MYSQL_URL = "jdbc:mysql://" + MYSQL_HOST_NAME + ":" + MYSQL_PORT + "/" + MYSQL_DATABASE;

        KAFKA_HOST = PropertiesUtils.getProperty("kafka.host");
        KAFKA_PORT = PropertiesUtils.getProperty("kafka.port");
        KAFKA_BOOSTRAP_SERVERS = KAFKA_HOST + ":" + KAFKA_PORT;
        KAFKA_TOPIC_CDC = PropertiesUtils.getProperty("kafka.topic.cdc");
        KAFKA_TOPIC_ORDER_WINDOW = PropertiesUtils.getProperty("kafka.topic.order-window");
        KAFKA_GROUP = PropertiesUtils.getProperty("kafka.group");

        REDIS_HOST = PropertiesUtils.getProperty("redis.host");
        REDIS_PORT = Integer.parseInt(PropertiesUtils.getProperty("redis.port"));
        REDIS_PASSWORD = PropertiesUtils.getProperty("redis.password");
        REDIS_DATABASE = PropertiesUtils.getProperty("redis.database");
        REDIS_KEY = PropertiesUtils.getProperty("redis.key");

        FLINK_WINDOWS =  Integer.parseInt(PropertiesUtils.getProperty("flink.window"));
        FLINK_WINDOWS_DELAY_TIME =  Integer.parseInt(PropertiesUtils.getProperty("flink.window.delay.time"));
    }

}
